#include  <stdlib.h>
#include <graphics.h>
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>

void draw_planeChang();
void main()
{
	int maxx,maxy,driver,mode,i;
	driver=DETECT;
	initgraph(&driver,&mode,"C:\\borlandc\\bgi");
	maxx=getmaxx();
	maxy=getmaxy();
	setbkcolor(LIGHTGRAY);
	draw_planeChang();
	getch();
}
void draw_planeChang()
{
	int maxx,maxy,i;
	//int chang_top[8]={maxx/2+7,maxy/2-65,maxx/2+20,maxy/2-50,maxx/2+7,maxy/2-50,maxx/2+7,maxy/2-65};
	maxx=getmaxx();
	maxy=getmaxy();
	setcolor(BLUE);
	setfillstyle(1,RED^BLUE);
	rectangle(5,5,maxx-100,maxy-50);
	
	//停机场
	/*setfillstyle(SOLID_FILL,WHITE);
	bar(7,maxy/2-65,maxx/2+7,maxy-75);
	setcolor(YELLOW^RED^GREEN);*/
	setfillstyle(SOLID_FILL,YELLOW^RED^GREEN);
	bar(20,maxy/2-50,maxx/2+20,maxy-60);
	//fillpoly(4,chang_top);

	//机场公路
	setfillstyle(SOLID_FILL,BLUE);
	bar(20,maxy*3/4-90,maxx/2+20,maxy*3/4-20);
	setfillstyle(SOLID_FILL,LIGHTBLUE);
	bar(20,maxy*3/4-90+2,maxx/2+20,maxy*3/4-20-2);
	
	//停车位
	setcolor(RED);
	setlinestyle(DOTTED_LINE,0,THICK_WIDTH);
	for(i=1;i<5;i++)
		rectangle((maxx/10-48)*i+60*(i-1)+20, (maxy/2-50)+(maxy/8-50),(maxx/10+12)*i+20, (maxy/2-50)+(maxy/8-50)+60);
	for(i=1;i<5;i++)
		rectangle((maxx/10-48)*i+60*(i-1)+20, (maxy*3/4-20)+(maxy/8-50),(maxx/10+12)*i+20, (maxy*3/4-20)+(maxy/8-50)+60);
	
}
void draw_plane(int x,int y,int col)
{
	int color[5]={WHITE,BLUE,LIGHTBLUE,RED,YELLOW};
	int right[]={x+3,y-6,x+16,y-1,x+18,y+2,x+3,y+1,x+3,y-6};
	int left[]={x-4,y-6,x-16,y-1,x-18,y+2,x-4,y+1,x-4,y-6};
	int bottom[]={x-2,y+17,x-10,y+20,x-11,y+22,x+11,y+22,x+10,y+20,x+2,y+17,x-2,y+17};
	setcolor(BLACK);
	setfillstyle(1,RED^BLUE);
	fillpoly(5,right);
	fillpoly(5,left);
	fillpoly(8,bottom);
	setfillstyle(1,color[col]);
	sector(x,y,0,360,3,20);

	setcolor(BLACK);
	setfillstyle(SOLID_FILL,YELLOW^RED^GREEN);
	fillellipse(x,y-12,2,5);

	bar(x-1,y-5,x+1,y+5);
	setcolor(RED);
	setlinestyle(SOLID_LINE,0,NORM_WIDTH);
	rectangle(x-20,y-22,x+20,y+22);
}
